import * as React from 'react';
import UploadBasic from 'components/common/UploadBasic';
import { Row, Col, Input } from 'antd';

interface SauProps {
  onUploaded: (data: any) => void;
  onSearch: (name: string) => void;
  accept: string;
  activeKey: string;
}
export default function SearchAndUpload(props: SauProps) {
  let qTip = '搜索附件';
  if (props.activeKey === 'image') {
    qTip = '搜索图片';
  } else if (props.activeKey === 'audio') {
    qTip = '搜索音频';
  } else if (props.activeKey === 'video') {
    qTip = '搜索视频';
  }

  return (
    <Row gutter={8} style={{ width: 430, position: 'absolute', right: 0, top: 5 }}>
      <Col span={6}>
        <UploadBasic
          listType="text"
          multiple={true}
          target={props.accept}
          onSelected={props.onUploaded}
        />
      </Col>
      <Col span={18}>
        <Input.Search onSearch={props.onSearch} placeholder={qTip} />
      </Col>
    </Row>
  );
}
